package com.one.blocks.security.config.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author <a href="mailto:idler41@163.con">linfuxin</a> created on 2023-09-24 13:26:33
 */
@Data
@ConfigurationProperties(prefix = "app.blocks.security")
public class SecurityProperties {

    private String loginUrl;

    private String cookieName;

    private String sessionHeaderKey;

    private String sessionAttributeKey;

    private Long sessionTimeout = TimeUnit.MINUTES.toSeconds(60);

    private Long sessionRefreshSecond = TimeUnit.MINUTES.toSeconds(30);

    private String logoutUrl;

    private Form form;

    private List<String> excludeUrl;

    private Rsa rsa;

    @Data
    public static class Form {
        private Boolean usernameEnable;

        private String username;

        private String password;

        private Boolean smsCodeEnable;

        private String mobile;

        private String smsCode;
    }

    @Data
    public static class Rsa {

        private boolean enable;

        private String privateKey;
    }
}
